package com.winning.gjhlht.bi.job;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import javax.xml.namespace.QName;

import org.apache.cxf.endpoint.Client;
import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;
import org.apache.log4j.Logger;
import org.dom4j.Document;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import chiss.org.draft.ihs.Expression;
import chiss.org.draft.ihs.FrequencyUse;
import chiss.org.draft.ihs.HealthStatistics;
import chiss.org.draft.ihs.HealthStatisticsAddress;
import chiss.org.draft.ihs.HealthStatisticsAuthenticator;
import chiss.org.draft.ihs.HealthStatisticsCustdian;
import chiss.org.draft.ihs.HealthStatisticsIndicator;
import chiss.org.draft.ihs.Identifier;
import chiss.org.draft.ihs.IndicatorData;
import chiss.org.draft.ihs.ProvideHealthStatisticsData;

import com.winning.common.Constans;
import com.winning.common.data.dao.AppBaseDao;
import com.winning.common.tools.XMLTool;
import com.winning.core.job.BaseJob;

/**
 * 类名称：BIDataUploadJober
 * 类描述：总管指标数据上传任务
 * 创建人：liuwensheng
 * 创建时间：2017-1-3 下午1:54:45
 * 修改人：liuwensheng
 * 修改时间：2017-1-3 下午1:54:45
 * 修改备注：
 */
public class BIDataUploadJober extends BaseJob {

    private static Logger LOGGER = Logger.getLogger(Constans.LOG4J_PBS_LOGGER_ID);

    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {

        String wsdlURL = "http://59.255.59.31:8280/services/zhglWS?wsdl";


        Object[] result = null;

        String responseXMLMessage = "";

        LOGGER.info("--------------------------------------------------------------");

        LOGGER.info("--> wsdlURL:" + wsdlURL);

        // 不依赖服务器端接口来完成调用的，也就是不仅仅能调用Java的接口
        JaxWsDynamicClientFactory clientFactory = JaxWsDynamicClientFactory
                .newInstance();
        Client client = clientFactory.createClient(wsdlURL);

        QName name = new QName("urn:org.chiss:draft:ihs",
                "ProvideHealthStatisticsData");
        // Client client = clientFactory.createClient(wsdlURL);

        AppBaseDao abd = new AppBaseDao();
        String[] sqls = {/* YLFW_YLXL_010 */
                //"select '出院患者药品费用' fzmc,'出院人次' fmmc,to_char(sysdate,'yyyy-mm-mm\"T\"hh24:mi:ss') TBRQ,BSF,substr(b.tjsj,1,4) tjsj_n,substr(b.tjsj,6,7) tjsj_y,c.dzqhdm,b.jgbm,b.jgjc,b.fbpl  , sum(case zbdm when  'YPGL_GK_011' then zbz else 0 end) fzz,sum(case zbdm when  'YLFW_YLXL_010' then zbz else 0 end) fmz,  GJPTZBMC,JSGS,JSGSPTDM ,substr(SYS_GUID(),1,29) rando,dw from DIM_SCZBDZ a,FACT_XJSJSC b left join DIM_XZQHDZB c on c.jgdm=b.jgbm  where a.bsf='IHS-G-60' and b.zbdm in('YPGL_GK_011','YLFW_YLXL_010') and b.fbpl='Y' group by BSF,substr(b.tjsj,1,4),substr(b.tjsj,6,7),dw,jgbm,jgjc,b.fbpl,GJPTZBMC,JSGS,JSGSPTDM,c.dzqhdm"
                //			,"select '出院医保患者总费用' fzmc,'医保出院人次' fmmc,c.dzqhdm,to_char(sysdate,'yyyy-mm-mm\"T\"hh24:mi:ss') TBRQ,BSF,substr(b.tjsj,1,4) tjsj_n,substr(b.tjsj,6,7) tjsj_y,b.jgbm,b.jgjc,b.fbpl  , sum(case zbdm when  'YLBZ_YB_010' then zbz else 0 end) fzz,sum(case zbdm when  'YLBZ_YB_011' then zbz else 0 end) fmz,  GJPTZBMC,JSGS,JSGSPTDM ,substr(SYS_GUID(),1,29) rando,dw from DIM_SCZBDZ a,FACT_XJSJSC b left join DIM_XZQHDZB c on c.jgdm=b.jgbm where a.bsf='IHS-G-77' and b.zbdm in('YLBZ_YB_010','YLBZ_YB_011') and b.fbpl='Y' group by BSF,substr(b.tjsj,1,4),substr(b.tjsj,6,7),dw,jgbm,jgjc,b.fbpl,GJPTZBMC,JSGS,c.dzqhdm,JSGSPTDM"
                //			,"select '门诊收入' fzmc,'门诊人次' fmmc,c.dzqhdm,to_char(sysdate,'yyyy-mm-mm\"T\"hh24:mi:ss') TBRQ,BSF,substr(b.tjsj,1,4) tjsj_n,substr(b.tjsj,6,7) tjsj_y,b.jgbm,b.jgjc,b.fbpl  , sum(case zbdm when  'YLFW_YLFY_014' then zbz else 0 end) fzz,sum(case zbdm when  'YLFW_YLXL_001' then zbz else 0 end) fmz,  GJPTZBMC,JSGS,JSGSPTDM ,substr(SYS_GUID(),1,29) rando,dw from DIM_SCZBDZ a,FACT_XJSJSC b left join DIM_XZQHDZB c on c.jgdm=b.jgbm where a.bsf='IHS-G-46' and b.zbdm in('YLFW_YLFY_014','YLFW_YLXL_001') and b.fbpl='Y' group by BSF,substr(b.tjsj,1,4),substr(b.tjsj,6,7),dw,c.dzqhdm,jgbm,jgjc,b.fbpl,GJPTZBMC,JSGS,JSGSPTDM"
                //			,"select '出院患者总费用' fzmc,'出院人次' fmmc,c.dzqhdm,to_char(sysdate,'yyyy-mm-mm\"T\"hh24:mi:ss') TBRQ,BSF,substr(b.tjsj,1,4) tjsj_n,substr(b.tjsj,6,7) tjsj_y,b.jgbm,b.jgjc,b.fbpl  , sum(case zbdm when  'YLFW_YLFY_017' then zbz else 0 end) fzz,sum(case zbdm when  'YLFW_YLXL_010' then zbz else 0 end) fmz,  GJPTZBMC,JSGS,JSGSPTDM ,substr(SYS_GUID(),1,29) rando,dw from DIM_SCZBDZ a,FACT_XJSJSC b left join DIM_XZQHDZB c on c.jgdm=b.jgbm where a.bsf='IHS-G-47' and b.zbdm in('YLFW_YLFY_017','YLFW_YLXL_010') and b.fbpl='Y' group by BSF,substr(b.tjsj,1,4),substr(b.tjsj,6,7),dw,jgbm,c.dzqhdm,jgjc,b.fbpl,GJPTZBMC,JSGS,JSGSPTDM"
                //			,"select '出院者占用总床日数' fzmc,c.dzqhdm,'出院人次' fmmc,to_char(sysdate,'yyyy-mm-mm\"T\"hh24:mi:ss') TBRQ,BSF,substr(b.tjsj,1,4) tjsj_n,substr(b.tjsj,6,7) tjsj_y,b.jgbm,b.jgjc,b.fbpl  , sum(case zbdm when  'YLFW_YLXL_011' then zbz else 0 end) fzz,sum(case zbdm when  'YLFW_YLXL_010' then zbz else 0 end) fmz,  GJPTZBMC,JSGS,JSGSPTDM ,substr(SYS_GUID(),1,29) rando,dw from DIM_SCZBDZ a,FACT_XJSJSC b left join DIM_XZQHDZB c on c.jgdm=b.jgbm where a.bsf='IHS-G-35' and b.zbdm in('YLFW_YLXL_011','YLFW_YLXL_010') and b.fbpl='Y' group by BSF,substr(b.tjsj,1,4),c.dzqhdm,substr(b.tjsj,6,7),dw,jgbm,jgjc,b.fbpl,GJPTZBMC,JSGS,JSGSPTDM"
                //			,"select '出院者占用总床日数' fzmc,'实际开放总床日数' fmmc,c.dzqhdm,to_char(sysdate,'yyyy-mm-mm\"T\"hh24:mi:ss') TBRQ,BSF,substr(b.tjsj,1,4) tjsj_n,substr(b.tjsj,6,7) tjsj_y,b.jgbm,b.jgjc,b.fbpl  , sum(case zbdm when  'YLFW_YLXL_011' then zbz else 0 end) fzz,sum(case zbdm when  'YLFW_YLXL_017' then zbz else 0 end) fmz,  GJPTZBMC,JSGS,JSGSPTDM ,substr(SYS_GUID(),1,29) rando,dw from DIM_SCZBDZ a,FACT_XJSJSC b left join DIM_XZQHDZB c on c.jgdm=b.jgbm where a.bsf='IHS-G-36' and b.zbdm in('YLFW_YLXL_011','YLFW_YLXL_017') and b.fbpl='Y' group by BSF,substr(b.tjsj,1,4),substr(b.tjsj,6,7),dw,jgbm,jgjc,b.fbpl,GJPTZBMC,JSGS,c.dzqhdm,JSGSPTDM"
                //			,"select '出院人次' fzmc,'实有床位数' fmmc,c.dzqhdm,to_char(sysdate,'yyyy-mm-mm\"T\"hh24:mi:ss') TBRQ,BSF,substr(b.tjsj,1,4) tjsj_n,substr(b.tjsj,6,7) tjsj_y,b.jgbm,b.jgjc,b.fbpl  , sum(case zbdm when  'YLFW_YLXL_010' then zbz else 0 end) fzz,sum(case zbdm when  'YLFW_YLXL_014' then zbz else 0 end) fmz,  GJPTZBMC,JSGS,JSGSPTDM ,substr(SYS_GUID(),1,29) rando,dw from DIM_SCZBDZ a,FACT_XJSJSC b left join DIM_XZQHDZB c on c.jgdm=b.jgbm where a.bsf='IHS-G-37' and b.zbdm in('YLFW_YLXL_010','YLFW_YLXL_014') and b.fbpl='Y' group by c.dzqhdm,BSF,substr(b.tjsj,1,4),substr(b.tjsj,6,7),dw,jgbm,jgjc,b.fbpl,GJPTZBMC,JSGS,JSGSPTDM"
                //			,"select '入院与出院诊断符合人数' fzmc,'出院人次' fmmc,c.dzqhdm,to_char(sysdate,'yyyy-mm-mm\"T\"hh24:mi:ss') TBRQ,BSF,substr(b.tjsj,1,4) tjsj_n,substr(b.tjsj,6,7) tjsj_y,b.jgbm,b.jgjc,b.fbpl  , sum(case zbdm when  'YLFW_YLZL_057' then zbz else 0 end) fzz,sum(case zbdm when  'YLFW_YLXL_010' then zbz else 0 end) fmz,  GJPTZBMC,JSGS,JSGSPTDM ,substr(SYS_GUID(),1,29) rando,dw from DIM_SCZBDZ a,FACT_XJSJSC b left join DIM_XZQHDZB c on c.jgdm=b.jgbm where a.bsf='IHS-G-44' and b.zbdm in('YLFW_YLZL_057','YLFW_YLXL_010') and b.fbpl='Y' group by BSF,substr(b.tjsj,1,4),substr(b.tjsj,6,7),dw,jgbm,jgjc,b.fbpl,GJPTZBMC,JSGS,c.dzqhdm,JSGSPTDM"
                //			,"select '急诊收入' fzmc,'急诊人次' fmmc,c.dzqhdm,to_char(sysdate,'yyyy-mm-mm\"T\"hh24:mi:ss') TBRQ,BSF,substr(b.tjsj,1,4) tjsj_n,substr(b.tjsj,6,7) tjsj_y,b.jgbm,b.jgjc,b.fbpl  , sum(case zbdm when  'YLFW_YLFY_015' then zbz else 0 end) fzz,sum(case zbdm when  'YLFW_YLXL_002' then zbz else 0 end) fmz,  GJPTZBMC,JSGS,JSGSPTDM ,substr(SYS_GUID(),1,29) rando,dw from DIM_SCZBDZ a,FACT_XJSJSC b left join DIM_XZQHDZB c on c.jgdm=b.jgbm where a.bsf='IHS-G-48' and b.zbdm in('YLFW_YLFY_015','YLFW_YLXL_002') and b.fbpl='Y' group by BSF,c.dzqhdm,substr(b.tjsj,1,4),substr(b.tjsj,6,7),dw,jgbm,jgjc,b.fbpl,GJPTZBMC,JSGS,JSGSPTDM"
                //			,"select '门诊药品收入' fzmc,'门诊人次' fmmc,c.dzqhdm,to_char(sysdate,'yyyy-mm-mm\"T\"hh24:mi:ss') TBRQ,BSF,substr(b.tjsj,1,4) tjsj_n,substr(b.tjsj,6,7) tjsj_y,b.jgbm,b.jgjc,b.fbpl  , sum(case zbdm when  'YPGL_GK_001' then zbz else 0 end) fzz,sum(case zbdm when  'YLFW_YLXL_001' then zbz else 0 end) fmz,  GJPTZBMC,JSGS,JSGSPTDM ,substr(SYS_GUID(),1,29) rando,dw from DIM_SCZBDZ a,FACT_XJSJSC b left join DIM_XZQHDZB c on c.jgdm=b.jgbm where a.bsf='IHS-G-58' and b.zbdm in('YPGL_GK_001','YLFW_YLXL_001') and b.fbpl='Y' group by BSF,c.dzqhdm,substr(b.tjsj,1,4),substr(b.tjsj,6,7),dw,jgbm,jgjc,b.fbpl,GJPTZBMC,JSGS,JSGSPTDM"
                //			,"select '急诊药品费用' fzmc,'急诊人次' fmmc,c.dzqhdm,to_char(sysdate,'yyyy-mm-mm\"T\"hh24:mi:ss') TBRQ,BSF,substr(b.tjsj,1,4) tjsj_n,substr(b.tjsj,6,7) tjsj_y,b.jgbm,b.jgjc,b.fbpl  , sum(case zbdm when  'YPGL_GK_002' then zbz else 0 end) fzz,sum(case zbdm when  'YLFW_YLXL_002' then zbz else 0 end) fmz,  GJPTZBMC,JSGS,JSGSPTDM ,substr(SYS_GUID(),1,29) rando,dw from DIM_SCZBDZ a,FACT_XJSJSC b left join DIM_XZQHDZB c on c.jgdm=b.jgbm where a.bsf='IHS-G-59' and b.zbdm in('YPGL_GK_002','YLFW_YLXL_002') and b.fbpl='Y' group by BSF,c.dzqhdm,substr(b.tjsj,1,4),substr(b.tjsj,6,7),dw,jgbm,jgjc,b.fbpl,GJPTZBMC,JSGS,JSGSPTDM"
                //			,"select '门诊医保总收入' fzmc,'门诊医保总人次' fmmc,c.dzqhdm,to_char(sysdate,'yyyy-mm-mm\"T\"hh24:mi:ss') TBRQ,BSF,substr(b.tjsj,1,4) tjsj_n,substr(b.tjsj,6,7) tjsj_y,b.jgbm,b.jgjc,b.fbpl  , sum(case zbdm when  'YLBZ_YB_001' then zbz else 0 end) fzz,sum(case zbdm when  'YLBZ_YB_004' then zbz else 0 end) fmz,  GJPTZBMC,JSGS,JSGSPTDM ,substr(SYS_GUID(),1,29) rando,dw from DIM_SCZBDZ a,FACT_XJSJSC b left join DIM_XZQHDZB c on c.jgdm=b.jgbm where a.bsf='IHS-G-75' and b.zbdm in('YLBZ_YB_001','YLBZ_YB_004') and b.fbpl='Y' group by BSF,substr(b.tjsj,1,4),c.dzqhdm,substr(b.tjsj,6,7),dw,jgbm,jgjc,b.fbpl,GJPTZBMC,JSGS,JSGSPTDM"
                //			,"select '急诊医保总收入' fzmc,'急诊医保总人次' fmmc,c.dzqhdm,to_char(sysdate,'yyyy-mm-mm\"T\"hh24:mi:ss') TBRQ,BSF,substr(b.tjsj,1,4) tjsj_n,substr(b.tjsj,6,7) tjsj_y,b.jgbm,b.jgjc,b.fbpl  , sum(case zbdm when  'YLBZ_YB_002' then zbz else 0 end) fzz,sum(case zbdm when  'YLBZ_YB_005' then zbz else 0 end) fmz,  GJPTZBMC,JSGS,JSGSPTDM ,substr(SYS_GUID(),1,29) rando,dw from DIM_SCZBDZ a,FACT_XJSJSC b left join DIM_XZQHDZB c on c.jgdm=b.jgbm where a.bsf='IHS-G-76' and b.zbdm in('YLBZ_YB_002','YLBZ_YB_005') and b.fbpl='Y' group by BSF,substr(b.tjsj,1,4),substr(b.tjsj,6,7),dw,c.dzqhdm,jgbm,jgjc,b.fbpl,GJPTZBMC,JSGS,JSGSPTDM"
                //			,"select '门诊人次' fzmc,'急诊人次' fmmc,c.dzqhdm,to_char(sysdate,'yyyy-mm-mm\"T\"hh24:mi:ss') TBRQ,BSF,substr(b.tjsj,1,4) tjsj_n,substr(b.tjsj,6,7) tjsj_y,b.jgbm,b.jgjc,b.fbpl  , sum(case zbdm when  'YLFW_YLXL_001' then zbz else 0 end) fzz,sum(case zbdm when  'YLFW_YLXL_002' then zbz else 0 end) fmz,  GJPTZBMC,JSGS,JSGSPTDM ,substr(SYS_GUID(),1,29) rando,dw from DIM_SCZBDZ a,FACT_XJSJSC b left join DIM_XZQHDZB c on c.jgdm=b.jgbm where a.bsf='IHS-G-28' and b.zbdm in('YLFW_YLXL_001','YLFW_YLXL_002') and b.fbpl='Y' group by BSF,substr(b.tjsj,1,4),substr(b.tjsj,6,7),dw,c.dzqhdm,jgbm,jgjc,b.fbpl,GJPTZBMC,JSGS,JSGSPTDM"
                //	"select '出院人次' fzmc,'0' fmmc,c.dzqhdm,to_char(sysdate,'yyyy-mm-mm\"T\"hh24:mi:ss') TBRQ,BSF,substr(b.tjsj,1,4) tjsj_n,substr(b.tjsj,6,7) tjsj_y,b.jgbm,b.jgjc,b.fbpl  , sum(case zbdm when  'YLFW_YLXL_010' then zbz else 0 end) fzz,0 fmz,  GJPTZBMC,JSGS,JSGSPTDM ,substr(SYS_GUID(),1,29) rando,dw from DIM_SCZBDZ a,FACT_XJSJSC b left join DIM_XZQHDZB c on c.jgdm=b.jgbm where a.bsf='IHS-G-30' and b.zbdm in('YLFW_YLXL_010','YLFW_YLXL_010') and b.fbpl='Y' group by BSF,substr(b.tjsj,1,4),substr(b.tjsj,6,7),c.dzqhdm,dw,jgbm,jgjc,b.fbpl,GJPTZBMC,JSGS,JSGSPTDM"
                //				"select '婴儿死亡数' fzmc,'活产数' fmmc,c.dzqhdm,to_char(sysdate,'yyyy-mm-mm\"T\"hh24:mi:ss') TBRQ,BSF,substr(b.tjsj,1,4) tjsj_n,substr(b.tjsj,6,7) tjsj_y,b.jgbm,b.jgjc,b.fbpl  , sum(case zbdm when  'GGWS_SMTJ_003' then zbz else 0 end) fzz,sum(case zbdm when  'GGWS_ET_103' then zbz else 0 end) fmz,  GJPTZBMC,JSGS,JSGSPTDM ,substr(SYS_GUID(),1,29) rando,dw from DIM_SCZBDZ a,FACT_XJSJSC b left join DIM_XZQHDZB c on c.jgdm=b.jgbm where a.bsf='IHS-G-89' and b.zbdm in('GGWS_SMTJ_003','GGWS_ET_103') and b.fbpl='Y' group by BSF,substr(b.tjsj,1,4),substr(b.tjsj,6,7),dw,jgbm,jgjc,b.fbpl,GJPTZBMC,JSGS,c.dzqhdm,JSGSPTDM"
                //				,"select '居民已建立的健康档案数量' fzmc,'该地区居民数' fmmc,c.dzqhdm,to_char(sysdate,'yyyy-mm-mm\"T\"hh24:mi:ss') TBRQ,BSF,substr(b.tjsj,1,4) tjsj_n,substr(b.tjsj,6,7) tjsj_y,b.jgbm,b.jgjc,b.fbpl  , sum(case zbdm when  'GGWS_JKDA_003' then zbz else 0 end) fzz,sum(case zbdm when  'GGWS_JKDA_010' then zbz else 0 end) fmz,  GJPTZBMC,JSGS,JSGSPTDM ,substr(SYS_GUID(),1,29) rando,dw from DIM_SCZBDZ a,FACT_XJSJSC b left join DIM_XZQHDZB c on c.jgdm=b.jgbm where a.bsf='IHS-G-91' and b.zbdm in('GGWS_JKDA_003','GGWS_JKDA_010') and b.fbpl='N' group by BSF,substr(b.tjsj,1,4),substr(b.tjsj,6,7),dw,jgbm,jgjc,b.fbpl,GJPTZBMC,JSGS,c.dzqhdm,JSGSPTDM"
                //				,"select '血压有效控制人数' fzmc,'高血压管理人数' fmmc,c.dzqhdm,to_char(sysdate,'yyyy-mm-mm\"T\"hh24:mi:ss') TBRQ,BSF,substr(b.tjsj,1,4) tjsj_n,substr(b.tjsj,6,7) tjsj_y,b.jgbm,b.jgjc,b.fbpl  , sum(case zbdm when  'GGWS_GXY_016' then zbz else 0 end) fzz,sum(case zbdm when  'GGWS_GXY_013' then zbz else 0 end) fmz,  GJPTZBMC,JSGS,JSGSPTDM ,substr(SYS_GUID(),1,29) rando,dw from DIM_SCZBDZ a,FACT_XJSJSC b left join DIM_XZQHDZB c on c.jgdm=b.jgbm where a.bsf='IHS-G-1' and b.zbdm in('GGWS_GXY_016','GGWS_GXY_013') and b.fbpl='Y' group by BSF,substr(b.tjsj,1,4),substr(b.tjsj,6,7),dw,jgbm,jgjc,b.fbpl,GJPTZBMC,JSGS,c.dzqhdm,JSGSPTDM"
                //				,"select '高血压规范管理人数' fzmc,'高血压管理人数' fmmc,c.dzqhdm,to_char(sysdate,'yyyy-mm-mm\"T\"hh24:mi:ss') TBRQ,BSF,substr(b.tjsj,1,4) tjsj_n,substr(b.tjsj,6,7) tjsj_y,b.jgbm,b.jgjc,b.fbpl  , sum(case zbdm when  'GGWS_GXY_013' then zbz else 0 end) fzz,sum(case zbdm when  'GGWS_GXY_003' then zbz else 0 end) fmz,  GJPTZBMC,JSGS,JSGSPTDM ,substr(SYS_GUID(),1,29) rando,dw from DIM_SCZBDZ a,FACT_XJSJSC b left join DIM_XZQHDZB c on c.jgdm=b.jgbm where a.bsf='IHS-G-2' and b.zbdm in('GGWS_GXY_013','GGWS_GXY_003') and b.fbpl='Y' group by BSF,substr(b.tjsj,1,4),substr(b.tjsj,6,7),dw,jgbm,jgjc,b.fbpl,GJPTZBMC,JSGS,c.dzqhdm,JSGSPTDM"
                //				,"select '糖尿病规范管理人数' fzmc,'糖尿病管理人数' fmmc,c.dzqhdm,to_char(sysdate,'yyyy-mm-mm\"T\"hh24:mi:ss') TBRQ,BSF,substr(b.tjsj,1,4) tjsj_n,substr(b.tjsj,6,7) tjsj_y,b.jgbm,b.jgjc,b.fbpl  , sum(case zbdm when  'GGWS_TNB_007' then zbz else 0 end) fzz,sum(case zbdm when  'GGWS_TNB_006' then zbz else 0 end) fmz,  GJPTZBMC,JSGS,JSGSPTDM ,substr(SYS_GUID(),1,29) rando,dw from DIM_SCZBDZ a,FACT_XJSJSC b left join DIM_XZQHDZB c on c.jgdm=b.jgbm where a.bsf='IHS-G-2' and b.zbdm in('GGWS_TNB_007','GGWS_TNB_006') and b.fbpl='Y' group by BSF,substr(b.tjsj,1,4),substr(b.tjsj,6,7),dw,jgbm,jgjc,b.fbpl,GJPTZBMC,JSGS,c.dzqhdm,JSGSPTDM"
                //				,"select '最近一次随访空腹血糖达标人数' fzmc,'已管理的糖尿病患者人数' fmmc,c.dzqhdm,to_char(sysdate,'yyyy-mm-mm\"T\"hh24:mi:ss') TBRQ,BSF,substr(b.tjsj,1,4) tjsj_n,substr(b.tjsj,6,7) tjsj_y,b.jgbm,b.jgjc,b.fbpl  , sum(case zbdm when  'GGWS_TNB_010' then zbz else 0 end) fzz,sum(case zbdm when  'GGWS_TNB_006' then zbz else 0 end) fmz,  GJPTZBMC,JSGS,JSGSPTDM ,substr(SYS_GUID(),1,29) rando,dw from DIM_SCZBDZ a,FACT_XJSJSC b left join DIM_XZQHDZB c on c.jgdm=b.jgbm where a.bsf='IHS-G-7' and b.zbdm in('GGWS_TNB_010','GGWS_TNB_006') and b.fbpl='Y' group by BSF,substr(b.tjsj,1,4),substr(b.tjsj,6,7),dw,jgbm,jgjc,b.fbpl,GJPTZBMC,JSGS,c.dzqhdm,JSGSPTDM"
                //				,"select '剖宫产活产数' fzmc,'活产数' fmmc,c.dzqhdm,to_char(sysdate,'yyyy-mm-mm\"T\"hh24:mi:ss') TBRQ,BSF,substr(b.tjsj,1,4) tjsj_n,substr(b.tjsj,6,7) tjsj_y,b.jgbm,b.jgjc,b.fbpl  , sum(case zbdm when  'GGWS_FN_039' then zbz else 0 end) fzz,sum(case zbdm when  'GGWS_FN_040' then zbz else 0 end) fmz,  GJPTZBMC,JSGS,JSGSPTDM ,substr(SYS_GUID(),1,29) rando,dw from DIM_SCZBDZ a,FACT_XJSJSC b left join DIM_XZQHDZB c on c.jgdm=b.jgbm where a.bsf='IHS-G-15' and b.zbdm in('GGWS_FN_039','GGWS_FN_040') and b.fbpl='Y' group by BSF,substr(b.tjsj,1,4),substr(b.tjsj,6,7),dw,jgbm,jgjc,b.fbpl,GJPTZBMC,JSGS,c.dzqhdm,JSGSPTDM"
                //				,"select '新生儿听力筛查人数' fzmc,'活产数' fmmc,c.dzqhdm,to_char(sysdate,'yyyy-mm-mm\"T\"hh24:mi:ss') TBRQ,BSF,substr(b.tjsj,1,4) tjsj_n,substr(b.tjsj,6,7) tjsj_y,b.jgbm,b.jgjc,b.fbpl  , sum(case zbdm when  'GGWS_ET_010' then zbz else 0 end) fzz,sum(case zbdm when  'GGWS_FN_040' then zbz else 0 end) fmz,  GJPTZBMC,JSGS,JSGSPTDM ,substr(SYS_GUID(),1,29) rando,dw from DIM_SCZBDZ a,FACT_XJSJSC b left join DIM_XZQHDZB c on c.jgdm=b.jgbm where a.bsf='IHS-G-17' and b.zbdm in('GGWS_ET_010','GGWS_FN_040') and b.fbpl='Y' group by BSF,substr(b.tjsj,1,4),substr(b.tjsj,6,7),dw,jgbm,jgjc,b.fbpl,GJPTZBMC,JSGS,c.dzqhdm,JSGSPTDM"
                //				,"select '产妇系统管理人数' fzmc,'活产数' fmmc,c.dzqhdm,to_char(sysdate,'yyyy-mm-mm\"T\"hh24:mi:ss') TBRQ,BSF,substr(b.tjsj,1,4) tjsj_n,substr(b.tjsj,6,7) tjsj_y,b.jgbm,b.jgjc,b.fbpl  , sum(case zbdm when  'GGWS_FN_005' then zbz else 0 end) fzz,sum(case zbdm when  'GGWS_ET_103' then zbz else 0 end) fmz,  GJPTZBMC,JSGS,JSGSPTDM ,substr(SYS_GUID(),1,29) rando,dw from DIM_SCZBDZ a,FACT_XJSJSC b left join DIM_XZQHDZB c on c.jgdm=b.jgbm where a.bsf='IHS-G-16' and b.zbdm in('GGWS_FN_005','GGWS_ET_103') and b.fbpl='Y' group by BSF,substr(b.tjsj,1,4),substr(b.tjsj,6,7),dw,jgbm,jgjc,b.fbpl,GJPTZBMC,JSGS,c.dzqhdm,JSGSPTDM"
                "select '新生儿已访视数量' fzmc,'活产数' fmmc,c.dzqhdm,to_char(sysdate,'yyyy-mm-mm\"T\"hh24:mi:ss') TBRQ,BSF,substr(b.tjsj,1,4) tjsj_n,substr(b.tjsj,5,6) tjsj_y,b.jgbm,b.jgjc,b.fbpl  , sum(case zbdm when  'GGWS_ET_007' then zbz else 0 end) fzz,sum(case zbdm when  'GGWS_ET_103' then zbz else 0 end) fmz,  GJPTZBMC,JSGS,JSGSPTDM ,substr(SYS_GUID(),1,29) rando,dw from DIM_SCZBDZ a,FACT_XJSJSC b left join DIM_XZQHDZB c on c.jgdm=b.jgbm where a.bsf='IHS-G-19' and b.zbdm in('GGWS_ET_007','GGWS_ET_103') and b.fbpl='Y' group by BSF,substr(b.tjsj,1,4),substr(b.tjsj,5,6),dw,jgbm,jgjc,b.fbpl,GJPTZBMC,JSGS,c.dzqhdm,JSGSPTDM"
        };
        for (int si = 0; si < sqls.length; si++) {
            String sql = sqls[si];//"select '出院患者药品费用' fzmc,'出院人次' fmmc,to_char(sysdate,'yyyy-mm-mm\"T\"hh24:mi:ss') TBRQ,BSF,substr(b.tjsj,1,4) tjsj_n,substr(b.tjsj,6,7) tjsj_y,c.dzqhdm,b.jgbm,b.jgjc,b.fbpl  , sum(case zbdm when  'YPGL_GK_011' then zbz else 0 end) fzz,sum(case zbdm when  'YLFW_YLXL_010' then zbz else 0 end) fmz,  GJPTZBMC,JSGS,JSGSPTDM ,substr(SYS_GUID(),1,29) rando,dw from DIM_SCZBDZ a,FACT_XJSJSC b left join DIM_XZQHDZB c on c.jgdm=b.jgbm  where a.bsf='IHS-G-60' and b.zbdm in('YPGL_GK_011','YLFW_YLXL_010') and b.fbpl='Y' group by BSF,substr(b.tjsj,1,4),substr(b.tjsj,6,7),dw,jgbm,jgjc,b.fbpl,GJPTZBMC,JSGS,JSGSPTDM,c.dzqhdm";
            LOGGER.info("----sql=" + sql);
            String dataSourceID = "Default_SQL_Dev";
            List<HashMap<String, Object>> list = abd.executeQueryReturnMapListByDataSource(sql, new Object[]{}, dataSourceID);
            LOGGER.info("----------------for开始-----------------------------");
            int i = 0;
            String zbbzf = "";
            String dzqhdm_dm = "";
            for (HashMap<String, Object> hmp : list) {
                try {
                    //String wyid =  hmp.get("").toString();
                    i = 1;
                    String bsf = hmp.get("BSF").toString();
                    zbbzf = bsf;
                    i = 2;
                    String TBRQ = hmp.get("TBRQ").toString();
                    i = 3;
                    String fzmc = hmp.get("FZMC").toString();
                    i = 4;
                    String fmmc = hmp.get("FMMC").toString();
                    i = 5;
                    String year = hmp.get("TJSJ_N").toString();
                    i = 6;
                    String month = hmp.get("TJSJ_Y").toString();
                    i = 7;
                    String jgbm = hmp.get("JGBM").toString();
                    i = 8;
                    String jgjc = hmp.get("JGJC").toString();
                    i = 9;
                    String fbpl = "Y".equals(hmp.get("FBPL").toString()) ? "M" : "Y";
                    i = 10;
                    String fzz = hmp.get("FZZ").toString();
                    i = 11;
                    String fmz = hmp.get("FMZ").toString();
                    i = 12;
                    String gjptzbmc = hmp.get("GJPTZBMC").toString();
                    i = 13;
                    String jsgsptdm = hmp.get("JSGSPTDM").toString();
                    i = 14;
                    String rando = hmp.get("RANDO").toString();
                    i = 15;
                    String dw = hmp.get("DW").toString();
                    LOGGER.info("---区域化编码-->");
                    i = 16;
                    String dzqhdm = hmp.get("DZQHDM") == null ? "" : hmp.get("DZQHDM").toString();
                    dzqhdm_dm = dzqhdm;
                    i = 17;
                    ProvideHealthStatisticsData provideHealthStatisticsData = new ProvideHealthStatisticsData();
                    HealthStatistics healthStatistics = new HealthStatistics();
                    healthStatistics.setId(new chiss.org.draft.ihs.String(
                            rando));
                    healthStatistics.setCreatedTime(new chiss.org.draft.ihs.String(
                            TBRQ));
                    FrequencyUse frequencyUse = new FrequencyUse();
                    frequencyUse.setValue(fbpl);
                    healthStatistics.setFrequency(frequencyUse);
                    healthStatistics.setYear(new chiss.org.draft.ihs.String(year));
                    healthStatistics.setMonth(new chiss.org.draft.ihs.String(month));

                    HealthStatisticsAuthenticator healthStatisticsAuthenticator = new HealthStatisticsAuthenticator();
                    healthStatisticsAuthenticator.setId(new chiss.org.draft.ihs.String(
                            "1234566"));
                    healthStatisticsAuthenticator
                            .setName(new chiss.org.draft.ihs.String("张三"));
                    healthStatisticsAuthenticator
                            .setTime(new chiss.org.draft.ihs.String(
                                    "2016-12-29T10:10:10"));
                    healthStatistics
                            .setLegalAuthenticator(healthStatisticsAuthenticator);

                    HealthStatisticsCustdian healthStatisticsCustdian = new HealthStatisticsCustdian();
                    Identifier identifier = new Identifier();
                    identifier.setValue(jgbm);
                    healthStatisticsCustdian.setId(identifier);
                    healthStatisticsCustdian.setName(new chiss.org.draft.ihs.String(
                            jgjc));
                    healthStatisticsCustdian.setContact(new chiss.org.draft.ihs.String(
                            " "));

                    HealthStatisticsAddress healthStatisticsAddress = new HealthStatisticsAddress();
                    healthStatisticsAddress.setCountry(new chiss.org.draft.ihs.String(
                            " "));
                    healthStatisticsAddress.setState(new chiss.org.draft.ihs.String(
                            "660000"));
                    healthStatisticsAddress.setCity(new chiss.org.draft.ihs.String(
                            "660600"));
                    healthStatisticsAddress.setDistrict(new chiss.org.draft.ihs.String(
                            "660609"));
                    healthStatisticsCustdian.setAddress(healthStatisticsAddress);
                    healthStatisticsCustdian.setTelecom(new chiss.org.draft.ihs.String(
                            " "));
                    healthStatistics.setCustdian(healthStatisticsCustdian);

                    List<IndicatorData> indicatorDataList = new ArrayList<IndicatorData>();
                    IndicatorData indicatorData = new IndicatorData();
                    HealthStatisticsIndicator healthStatisticsIndicator = new HealthStatisticsIndicator();
                    healthStatisticsIndicator.setId(new chiss.org.draft.ihs.String(
                            bsf));
                    healthStatisticsIndicator
                            .setDisplay(new chiss.org.draft.ihs.String(gjptzbmc));
                    healthStatisticsIndicator.setUnit(new chiss.org.draft.ihs.String(
                            dw));

                    Expression expression = new Expression();
                    expression.setCalculation(new chiss.org.draft.ihs.String(jsgsptdm));
                    List<Expression.Variant> variantList = new ArrayList<Expression.Variant>();
                    Expression.Variant variant = new Expression.Variant();
                    variant.setKey("A");
                    variant.setDisplay(fzmc);
                    variantList.add(variant);
                    //if (!"0".equals(fmmc)){
                    Expression.Variant variant2 = new Expression.Variant();
                    variant2.setKey("B");
                    variant2.setDisplay(fmmc);
                    variantList.add(variant2);
                    //}
                    expression.setVariant(variantList);
                    healthStatisticsIndicator.setExpression(expression);
                    healthStatisticsIndicator
                            .setDescription(new chiss.org.draft.ihs.String(" "));
                    List<FrequencyUse> FrequencyUseList = new ArrayList<FrequencyUse>();
                    FrequencyUse frequencyUse1 = new FrequencyUse();
                    frequencyUse1.setValue(" ");
                    FrequencyUseList.add(frequencyUse1);
                    healthStatisticsIndicator.setFrequency(FrequencyUseList);

                    indicatorData.setIndicator(healthStatisticsIndicator);
                    chiss.org.draft.ihs.Code code = new chiss.org.draft.ihs.Code();
                    code.setValue(dzqhdm);
                    code.setDisplay(jgjc);
                    code.setSystem(" ");
                    indicatorData.setAdministrativeDivision(code);
                    List<IndicatorData.Data> datas = new ArrayList<IndicatorData.Data>();
                    IndicatorData.Data data = new IndicatorData.Data();
                    data.setKey("A");
                    data.setValue(Float.valueOf(fzz));
                    datas.add(data);
                    //if (!"0".equals(fmz)){
                    IndicatorData.Data data2 = new IndicatorData.Data();
                    data2.setKey("B");
                    data2.setValue(Float.valueOf(fmz));
                    datas.add(data2);
                    //}
                    indicatorData.setData(datas);
                    indicatorDataList.add(indicatorData);
                    healthStatistics.setIndicatorData(indicatorDataList);
                    provideHealthStatisticsData.setHealthStatistics(healthStatistics);
                    LOGGER.info("--> 调用开始------指标标识符为：" + bsf + "");
                    result = client.invoke(name, provideHealthStatisticsData);

                    LOGGER.info("--> 调用结束------指标标识符为：" + bsf + "");
                    if (result != null && result.length > 0) {

                        responseXMLMessage = (String) result[0];

                        LOGGER.info("--> cxf客户端调用返回结果:" + responseXMLMessage);
                    } else {
                        LOGGER.info("--> cxf客户端调用返回结果为null");
                    }


                } catch (Exception e) {
                    LOGGER.error(e, e.fillInStackTrace());
                    e.printStackTrace();
                } finally {
                    LOGGER.info("--iiii-->:" + Integer.toString(i));
                    LOGGER.info("--zbbzf-->:" + zbbzf);
                    LOGGER.info("--dzqhdm-->:" + dzqhdm_dm);

                }


				/*	try {
					// result = client.invoke("HIPMessageServer",
					// "PatientRegistryAddRequest", xmlStr);

					// result = client.invoke("RhinTerminologyServer",
					// "ProvideHealthStatisticsData", xmlStr);

				} catch (Exception e) {
					LOGGER.error(e, e.fillInStackTrace());
					e.printStackTrace();
				}*/
            }
            LOGGER.info("----------------for循环结束-----------------------------");

            /*
             * JaxWsDynamicClientFactory factory =
             * JaxWsDynamicClientFactory.newInstance();
             *
             * Client client = factory.createClient(wsdlURL, new
             * QName("urn:org.chiss:draft:ihs", "zhglWS"), new
             * QName("urn:org.chiss:draft:ihs", "zhglWSHttpSoap11Endpoint"));
             *
             * //处理 WebService接口和实现类namespace不同的情况
             *
             * // CXF动态客户端在处理此问题时，会报No operation was found with the name的异常 String
             * operation="ProvideHealthStatisticsData";
             *
             * Endpoint endpoint = client.getEndpoint(); LOGGER.info("--> wsdlURL:"
             * + wsdlURL); LOGGER.info("--> message:" + message); QName opName = new
             * QName(endpoint.getService().getName().getNamespaceURI(), operation);
             *
             * BindingInfo bindingInfo = endpoint.getEndpointInfo().getBinding();
             *
             * if (bindingInfo.getOperation(opName) == null) {
             *
             * for (BindingOperationInfo operationInfo :
             * bindingInfo.getOperations()) {
             *
             * if (operation.equals(operationInfo.getName().getLocalPart())) {
             *
             * opName = operationInfo.getName();
             *
             * break;}}}
             *
             * try { LOGGER.info("--> 调用开始     fggffggfgfgfgfgffggfgffggfgf");
             * result = client.invoke(opName, new Object[]
             * {"fggffggfgfgfgfgffggfgffggfgf"});
             *
             * LOGGER.info("--> 调用结束"); if (result != null && result.length > 0) {
             * responseXMLMessage = (String) result[0];
             *
             * LOGGER.info("--> cxf客户端调用返回结果:" + responseXMLMessage); } else {
             * LOGGER.info("--> cxf客户端调用返回结果为null"); }
             *
             * } catch (Exception e) {
             *
             *
             * e.printStackTrace();
             *
             * }
             */
        }
    }

}
